<%@ page import="cc.ddknight.site.iblog.service.UserService" %>
<%@ page import="cc.ddknight.site.iblog.service.impl.UserServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: ddknight
  Date: 2020/1/7
  Time: 14:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    UserService userService = new UserServiceImpl();
    String email = request.getParameter("email");
    String password = request.getParameter("password");
    boolean checkedResult = userService.checkUserLogin(email, password);
%>
<html>
<head>
    <title>CheckLogin</title>
</head>
<body>
登录验证中,请稍后...<br>
<%
    if(checkedResult){
        session.setAttribute("isLogin",Boolean.TRUE);
        session.setAttribute("loginUser",userService.getUserByEmail(email));
%>
登录成功
<%
    }else{
        session.setAttribute("isLogin",Boolean.FALSE);
        if(session.getAttribute("loginUser") != null) {
            session.removeAttribute("loginUser");
        }
%>
登录失败
<%
    }
%>
</body>
<script type="text/javascript">
    window.location.href="./index.jsp"
</script>
</html>
